<?php include('include/entete.html'); ?>

<br/><br/>

<div class="contenu">
	<table align="center" width="100%" cellpadding="3" cellspacing="0">
	<tr>
		<td id="cell1">Liste pays</td>
	</tr>
	<tr>
		<td id="cell2">

<br/>
<b><a href="form_recherche_emplacement.php">Rechercher emplacements</a></b>
<br/>

<?php

	try {
		$db = new PDO('mysql:host=localhost;dbname=campingcar', 'root', '');
		//echo 'Connected to database';
    }
	catch(PDOException $e) {
		echo $e->getMessage();
    }
	
	$sql = "SELECT distinct pays FROM emplacement ORDER BY pays";
	$select_messages = $db->prepare($sql);
	$select_messages->execute();
?>

<div class="table">
<table border="0" width="100%">
	<thead>
	<tr class="thead">
		<th>Pays</th>
	</tr>
	</thead>
	<tbody>
<?php
	$couleur = array(0 => "ligne1", 1 => "ligne2");
	$i = 0;
	foreach($select_messages->fetchAll() as $rec) {
		echo '<tr class="'.$couleur[$i%2].'">';
		echo '<td><a href="liste_emplacements.php?pays='.$rec['pays'].'">'.$rec['pays'].'</a></td>';
		echo '</tr>';
		$i++;
	}
?>
	</tbody>
</table>
</div>

</td>
</tr>
</table>
</div>

<br/><br/>
 
<?php include('include/piedPage.html'); ?>
